"""
URL configuration for supermarket_app project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/4.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from django.views.generic import TemplateView  # 用于直接返回HTML模板

urlpatterns = [
    path('admin/', admin.site.urls),  # Django自带Admin后台
    # 模块路由
    path('api/user/', include('user.urls')),  # 用户模块API
    path('api/product/', include('product.urls')),  # 商品模块API
    path('api/cart/', include('cart.urls')),  # 购物车模块API
    path('api/order/', include('order.urls')),  # 订单模块API
    path('api/inventory/', include('inventory.urls')),  # 库存模块API
    path('api/backend/', include('backend.urls')),  # 后台管理模块API
    # 页面路由（直接返回HTML）
    path('', TemplateView.as_view(template_name='cashier/CashierHome.html'), name='cashier_home'),  # 收银台首页
    path('screens/cashier/CashierSettingsScreen', TemplateView.as_view(template_name='cashier/CashierSettingsScreen.html'), name='cashier_settings'),  # 收银台设置页
    path('backend/list', TemplateView.as_view(template_name='backend/BackendHome.html'), name='backend_home'),  # 后台管理首页
    path('shopping/home', TemplateView.as_view(template_name='shopping/ShoppingHome.html'), name='shopping_home'),  # 网购首页
]
